﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace Kamikaze
{
    class Controles : SceneBase
    {
        Texture2D texturaControles;

        MouseState mouse, oldMouse;
        AnimatedObject botaoComecar;

        



        public override void start()
        {

            Game1.Self.IsMouseVisible = true;
            texturaControles = (Game1.Self.Content.Load<Texture2D>(@"Imagens/Controles"));

            Kamikaze.AnimatedObject.AnimationStructure animationContinue = new Kamikaze.AnimatedObject.AnimationStructure();
            animationContinue.frameCount = 1;
            animationContinue.frameWidth = 89;
            animationContinue.frameHeight = 56;
            animationContinue.framePerSecond = 1;
            animationContinue.X = 89 * 1;
            animationContinue.Y = 0;




            botaoComecar = new AnimatedObject(Game1.Self.Content.Load<Texture2D>(@"Imagens/botaoComecar"), 89, 56);
            botaoComecar.posicao.X = 550;
            botaoComecar.posicao.Y = 300;
            botaoComecar.listaAnimations.Add("continue", animationContinue);

           


        }

        public override void update(GameTime gameTime)
        {
            oldMouse = mouse;
            mouse = Mouse.GetState();

            botaoComecar.calcularRetangulo();
            botaoComecar.Update(gameTime);

            if (botaoComecar.collisionBounds.Contains(mouse.X, mouse.Y))
            {


                botaoComecar.ChangeAnimation("continue");



            }
            else
            {


                botaoComecar.ChangeAnimation("default");
            }



            if (mouse.LeftButton == ButtonState.Pressed && oldMouse != mouse)
            {
                if (botaoComecar.collisionBounds.Contains(mouse.X, mouse.Y))
                {
                    SceneManager.setScene(new level1());
                }
            }





        }



        public override void draw(SpriteBatch spriteBatch)
        {



            spriteBatch.Draw(texturaControles, new Vector2(0, 0), Color.White);
            botaoComecar.Draw(spriteBatch);
        }

        public override void terminate()
        {
            Game1.Self.IsMouseVisible = false;
        }








    }
}
